home *** CD-ROM | disk | FTP | other *** search
/ Aminet 28 / Aminet 28 (1998)(GTI - Schatztruhe)[!][Dec 1998].iso / Aminet / mus / misc / octaflip.lha / flip_allcmd.omed next >
Encoding:
Text File  |  1998-10-07  |  2.0 KB  |  66 lines

  1. /*    flipblock_allcmd.omed - arexx-script for octamed.
  2.      Flips the range or track including all the cmd-pages.
  3.     Made by Kjetil S. Matheussen 1998.
  4.  
  5.     Based on an arexx-script made by David T. Krupicz.
  6.     Changes: Rewritten it to work properly, included cmd-pages,
  7.     included it to work for all tracks in range, and
  8.     improoved speed with around 75%.
  9. */
  10.  
  11. OPTIONS RESULTS
  12.  
  13. ed_getnumpages VAR numpages
  14.  
  15. rn_isranged VAR isranged            /* is there a range? */
  16.  
  17. IF isranged THEN DO
  18.     rn_getrangestartline VAR rn_st
  19.     rn_getrangeendline VAR rn_end
  20.  
  21.     rn_getrangestarttrack VAR tr_st
  22.     rn_getrangeendtrack VAR tr_end
  23. END;ELSE DO
  24.     rn_st = 0
  25.     ed_getnumlines VAR rn_end
  26.     rn_end=rn_end-1
  27.     ed_getcurrtrack VAR tr_st
  28.     tr_end=tr_st
  29. END
  30.  
  31. length = ((rn_end - rn_st + 1)/2)-1
  32.  
  33. DO r=tr_st to tr_end
  34.     op_update off
  35.     DO i = 0 to length
  36.         drop top_note top_inum bot_note bot_inum
  37.         ed_getdata 't' r 'l' rn_st + i 'note' VAR top_note          /* get top note data */
  38.         ed_getdata 't' r 'l' rn_st + i 'inum' VAR top_inum
  39.         ed_getdata 't' r 'l' rn_end - i 'note' VAR bot_note          /* get BOTtom note data */
  40.         ed_getdata 't' r 'l' rn_end - i 'inum' VAR bot_inum
  41.         if ~(bot_note=top_note) then do
  42.             ed_setdata 't' r 'l' rn_st + i 'note' bot_note
  43.             ed_setdata 't' r 'l' rn_end - i 'note' top_note
  44.         end
  45.         if ~(bot_inum=top_inum) then do
  46.             ed_setdata 't' r 'l' rn_st + i 'inum' bot_inum
  47.             ed_setdata 't' r 'l' rn_end - i 'inum' top_inum
  48.         end
  49.         DO l = 1 TO numpages
  50.             drop top_cmdnum top_qual bot_cmdnum bot_qual
  51.             ed_getdata 't' r 'l' rn_st + i 'p' l 'cmdnum' VAR top_cmdnum
  52.             ed_getdata 't' r 'l' rn_st + i 'p' l 'qual' VAR top_qual
  53.             ed_getdata 't' r 'l' rn_end - i 'p' l 'cmdnum' VAR bot_cmdnum
  54.             ed_getdata 't' r 'l' rn_end - i 'p' l 'qual' VAR bot_qual
  55.             if ~(bot_cmdnum=top_cmdnum) then do
  56.                 ed_setdata 't' r 'l' rn_st + i 'p' l 'cmdnum' bot_cmdnum
  57.                 ed_setdata 't' r 'l' rn_end - i 'p' l 'cmdnum' top_cmdnum
  58.             end
  59.             if ~(bot_qual=top_qual) then do
  60.                 ed_setdata 't' r 'l' rn_st + i 'p' l 'qual' bot_qual
  61.                 ed_setdata 't' r 'l' rn_end - i 'p' l 'qual' top_qual
  62.             end
  63.         END
  64.     END
  65.     op_update on
  66. END